package us.wili.dev.model.example;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

public class ShopcartExample {
    protected Order order;

    protected boolean distinct;

    protected String lock;

    protected List oredCriteria;

    protected Selector selector;

    protected Limit limit;

    public ShopcartExample() {
        oredCriteria = new ArrayList<>();
        distinct = false;
        lock = "";
    }

    public void setDistinct(boolean distinct) {
        this.distinct = distinct;
    }

    public boolean isDistinct() {
        return distinct;
    }

    public String getLock() {
        return lock;
    }

    public List getOredCriteria() {
        return oredCriteria;
    }

    public Selector getSelector() {
        return selector;
    }

    public Limit getLimit() {
        return limit;
    }

    public Selector select() {
        selector = new Selector();
        return selector;
    }

    public Order orderBy() {
        order = new Order();
        return order;
    }

    public void limit(int rowCount) {
        limit = new Limit(rowCount);
    }

    public void limit(int offset, int rowCount) {
        limit = new Limit(offset, rowCount);
    }

    public void forUpdate() {
        lock = "for update";
    }

    public void lockInShareMode() {
        lock = "lock in share mode";
    }

    public void or(Criteria criteria) {
        oredCriteria.add(criteria);
    }

    public Criteria or() {
        Criteria criteria = new Criteria();
        oredCriteria.add(new Criteria());
        return criteria;
    }

    public Criteria createCriteria() {
        Criteria criteria = new Criteria();
        if (oredCriteria.size() == 0) {
            oredCriteria.add(criteria);
        }
        return criteria;
    }

    public void clear() {
        oredCriteria.clear();
        distinct = false;
    }

    public void clearLock() {
        lock = "";
    }

    public void clearLimit() {
        limit = null;
    }

    protected abstract static class GeneratedCriteria {
        protected List<Criterion> criteria;

        protected GeneratedCriteria() {
            super();
            criteria = new ArrayList<>();
        }

        public boolean isValid() {
            return criteria.size() > 0;
        }

        public List<Criterion> getCriteria() {
            return criteria;
        }

        protected void addCriterion(String condition) {
            if (condition == null) {
                return;
            }
            criteria.add(new Criterion(condition));
        }

        protected void addCriterion(String condition, Object value) {
            if (value == null) {
                return;
            }
            criteria.add(new Criterion(condition, value));
        }

        protected void addCriterion(String condition, Object value1, Object value2) {
            if (value1 == null || value2 == null) {
                return;
            }
            criteria.add(new Criterion(condition, value1, value2));
        }

        public Criteria andIdEqualTo(Long value) {
            addCriterion("`id` =", value);
            return (Criteria) this;
        }

        public Criteria andIdNotEqualTo(Long value) {
            addCriterion("`id` <>", value);
            return (Criteria) this;
        }

        public Criteria andIdGreaterThan(Long value) {
            addCriterion("`id` >", value);
            return (Criteria) this;
        }

        public Criteria andIdGreaterThanOrEqualTo(Long value) {
            addCriterion("`id` >=", value);
            return (Criteria) this;
        }

        public Criteria andIdLessThan(Long value) {
            addCriterion("`id` <", value);
            return (Criteria) this;
        }

        public Criteria andIdLessThanOrEqualTo(Long value) {
            addCriterion("`id` <=", value);
            return (Criteria) this;
        }

        public Criteria andIdIn(List<Long> values) {
            addCriterion("`id` in ", values);
            return (Criteria) this;
        }

        public Criteria andIdNotIn(List<Long> values) {
            addCriterion("`id` not  in ", values);
            return (Criteria) this;
        }

        public Criteria andIdBetween(Long value1, Long value2) {
            addCriterion("`id` between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andIdNotBetween(Long value1, Long value2) {
            addCriterion("`id` not between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andUseridIsNull() {
            addCriterion("`userid` is null");
            return (Criteria) this;
        }

        public Criteria andUseridIsNotNull() {
            addCriterion("`userid` is not null");
            return (Criteria) this;
        }

        public Criteria andUseridEqualTo(Long value) {
            addCriterion("`userid` =", value);
            return (Criteria) this;
        }

        public Criteria andUseridNotEqualTo(Long value) {
            addCriterion("`userid` <>", value);
            return (Criteria) this;
        }

        public Criteria andUseridGreaterThan(Long value) {
            addCriterion("`userid` >", value);
            return (Criteria) this;
        }

        public Criteria andUseridGreaterThanOrEqualTo(Long value) {
            addCriterion("`userid` >=", value);
            return (Criteria) this;
        }

        public Criteria andUseridLessThan(Long value) {
            addCriterion("`userid` <", value);
            return (Criteria) this;
        }

        public Criteria andUseridLessThanOrEqualTo(Long value) {
            addCriterion("`userid` <=", value);
            return (Criteria) this;
        }

        public Criteria andUseridIn(List<Long> values) {
            addCriterion("`userid` in ", values);
            return (Criteria) this;
        }

        public Criteria andUseridNotIn(List<Long> values) {
            addCriterion("`userid` not  in ", values);
            return (Criteria) this;
        }

        public Criteria andUseridBetween(Long value1, Long value2) {
            addCriterion("`userid` between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andUseridNotBetween(Long value1, Long value2) {
            addCriterion("`userid` not between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andGoodsIdIsNull() {
            addCriterion("`goods_id` is null");
            return (Criteria) this;
        }

        public Criteria andGoodsIdIsNotNull() {
            addCriterion("`goods_id` is not null");
            return (Criteria) this;
        }

        public Criteria andGoodsIdEqualTo(Long value) {
            addCriterion("`goods_id` =", value);
            return (Criteria) this;
        }

        public Criteria andGoodsIdNotEqualTo(Long value) {
            addCriterion("`goods_id` <>", value);
            return (Criteria) this;
        }

        public Criteria andGoodsIdGreaterThan(Long value) {
            addCriterion("`goods_id` >", value);
            return (Criteria) this;
        }

        public Criteria andGoodsIdGreaterThanOrEqualTo(Long value) {
            addCriterion("`goods_id` >=", value);
            return (Criteria) this;
        }

        public Criteria andGoodsIdLessThan(Long value) {
            addCriterion("`goods_id` <", value);
            return (Criteria) this;
        }

        public Criteria andGoodsIdLessThanOrEqualTo(Long value) {
            addCriterion("`goods_id` <=", value);
            return (Criteria) this;
        }

        public Criteria andGoodsIdIn(List<Long> values) {
            addCriterion("`goods_id` in ", values);
            return (Criteria) this;
        }

        public Criteria andGoodsIdNotIn(List<Long> values) {
            addCriterion("`goods_id` not  in ", values);
            return (Criteria) this;
        }

        public Criteria andGoodsIdBetween(Long value1, Long value2) {
            addCriterion("`goods_id` between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andGoodsIdNotBetween(Long value1, Long value2) {
            addCriterion("`goods_id` not between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andGoodsNumIsNull() {
            addCriterion("`goods_num` is null");
            return (Criteria) this;
        }

        public Criteria andGoodsNumIsNotNull() {
            addCriterion("`goods_num` is not null");
            return (Criteria) this;
        }

        public Criteria andGoodsNumEqualTo(Integer value) {
            addCriterion("`goods_num` =", value);
            return (Criteria) this;
        }

        public Criteria andGoodsNumNotEqualTo(Integer value) {
            addCriterion("`goods_num` <>", value);
            return (Criteria) this;
        }

        public Criteria andGoodsNumGreaterThan(Integer value) {
            addCriterion("`goods_num` >", value);
            return (Criteria) this;
        }

        public Criteria andGoodsNumGreaterThanOrEqualTo(Integer value) {
            addCriterion("`goods_num` >=", value);
            return (Criteria) this;
        }

        public Criteria andGoodsNumLessThan(Integer value) {
            addCriterion("`goods_num` <", value);
            return (Criteria) this;
        }

        public Criteria andGoodsNumLessThanOrEqualTo(Integer value) {
            addCriterion("`goods_num` <=", value);
            return (Criteria) this;
        }

        public Criteria andGoodsNumIn(List<Integer> values) {
            addCriterion("`goods_num` in ", values);
            return (Criteria) this;
        }

        public Criteria andGoodsNumNotIn(List<Integer> values) {
            addCriterion("`goods_num` not  in ", values);
            return (Criteria) this;
        }

        public Criteria andGoodsNumBetween(Integer value1, Integer value2) {
            addCriterion("`goods_num` between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andGoodsNumNotBetween(Integer value1, Integer value2) {
            addCriterion("`goods_num` not between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andCreatedAtEqualTo(LocalDateTime value) {
            addCriterion("`created_at` =", value);
            return (Criteria) this;
        }

        public Criteria andCreatedAtNotEqualTo(LocalDateTime value) {
            addCriterion("`created_at` <>", value);
            return (Criteria) this;
        }

        public Criteria andCreatedAtGreaterThan(LocalDateTime value) {
            addCriterion("`created_at` >", value);
            return (Criteria) this;
        }

        public Criteria andCreatedAtGreaterThanOrEqualTo(LocalDateTime value) {
            addCriterion("`created_at` >=", value);
            return (Criteria) this;
        }

        public Criteria andCreatedAtLessThan(LocalDateTime value) {
            addCriterion("`created_at` <", value);
            return (Criteria) this;
        }

        public Criteria andCreatedAtLessThanOrEqualTo(LocalDateTime value) {
            addCriterion("`created_at` <=", value);
            return (Criteria) this;
        }

        public Criteria andCreatedAtIn(List<LocalDateTime> values) {
            addCriterion("`created_at` in ", values);
            return (Criteria) this;
        }

        public Criteria andCreatedAtNotIn(List<LocalDateTime> values) {
            addCriterion("`created_at` not  in ", values);
            return (Criteria) this;
        }

        public Criteria andCreatedAtBetween(LocalDateTime value1, LocalDateTime value2) {
            addCriterion("`created_at` between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andCreatedAtNotBetween(LocalDateTime value1, LocalDateTime value2) {
            addCriterion("`created_at` not between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtEqualTo(LocalDateTime value) {
            addCriterion("`updated_at` =", value);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtNotEqualTo(LocalDateTime value) {
            addCriterion("`updated_at` <>", value);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtGreaterThan(LocalDateTime value) {
            addCriterion("`updated_at` >", value);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtGreaterThanOrEqualTo(LocalDateTime value) {
            addCriterion("`updated_at` >=", value);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtLessThan(LocalDateTime value) {
            addCriterion("`updated_at` <", value);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtLessThanOrEqualTo(LocalDateTime value) {
            addCriterion("`updated_at` <=", value);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtIn(List<LocalDateTime> values) {
            addCriterion("`updated_at` in ", values);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtNotIn(List<LocalDateTime> values) {
            addCriterion("`updated_at` not  in ", values);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtBetween(LocalDateTime value1, LocalDateTime value2) {
            addCriterion("`updated_at` between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andUpdatedAtNotBetween(LocalDateTime value1, LocalDateTime value2) {
            addCriterion("`updated_at` not between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andVersionIsNull() {
            addCriterion("`version` is null");
            return (Criteria) this;
        }

        public Criteria andVersionIsNotNull() {
            addCriterion("`version` is not null");
            return (Criteria) this;
        }

        public Criteria andVersionEqualTo(Long value) {
            addCriterion("`version` =", value);
            return (Criteria) this;
        }

        public Criteria andVersionNotEqualTo(Long value) {
            addCriterion("`version` <>", value);
            return (Criteria) this;
        }

        public Criteria andVersionGreaterThan(Long value) {
            addCriterion("`version` >", value);
            return (Criteria) this;
        }

        public Criteria andVersionGreaterThanOrEqualTo(Long value) {
            addCriterion("`version` >=", value);
            return (Criteria) this;
        }

        public Criteria andVersionLessThan(Long value) {
            addCriterion("`version` <", value);
            return (Criteria) this;
        }

        public Criteria andVersionLessThanOrEqualTo(Long value) {
            addCriterion("`version` <=", value);
            return (Criteria) this;
        }

        public Criteria andVersionIn(List<Long> values) {
            addCriterion("`version` in ", values);
            return (Criteria) this;
        }

        public Criteria andVersionNotIn(List<Long> values) {
            addCriterion("`version` not  in ", values);
            return (Criteria) this;
        }

        public Criteria andVersionBetween(Long value1, Long value2) {
            addCriterion("`version` between", value1, value2);
            return (Criteria) this;
        }

        public Criteria andVersionNotBetween(Long value1, Long value2) {
            addCriterion("`version` not between", value1, value2);
            return (Criteria) this;
        }
    }

    public static class Criteria extends GeneratedCriteria {

        protected Criteria() {
            super();
        }
    }

    public static class Criterion {
        private String condition;

        private Object value;

        private Object secondValue;

        private boolean noValue;

        private boolean singleValue;

        private boolean betweenValue;

        private boolean listValue;

        private String typeHandler;

        public String getCondition() {
            return condition;
        }

        public Object getValue() {
            return value;
        }

        public Object getSecondValue() {
            return secondValue;
        }

        public boolean isNoValue() {
            return noValue;
        }

        public boolean isSingleValue() {
            return singleValue;
        }

        public boolean isBetweenValue() {
            return betweenValue;
        }

        public boolean isListValue() {
            return listValue;
        }

        public String getTypeHandler() {
            return typeHandler;
        }

        protected Criterion(String condition) {
            super();
            this.condition = condition;
            this.typeHandler = null;
            this.noValue = true;
        }

        protected Criterion(String condition, Object value, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.typeHandler = typeHandler;
            if (value instanceof List<?>) {
                this.listValue = true;
            } else {
                this.singleValue = true;
            }
        }

        protected Criterion(String condition, Object value) {
            this(condition, value, null);
        }

        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.secondValue = secondValue;
            this.typeHandler = typeHandler;
            this.betweenValue = true;
        }

        protected Criterion(String condition, Object value, Object secondValue) {
            this(condition, value, secondValue, null);
        }
    }

    public static class Selector {
        private List<String> columns = new ArrayList<>();

        public int getSize() {
            return columns.size();
        }

        public Selector addWithAlias(String column) {
            columns.add(column+ "AS `" + column + "`");
            return this;
        }

        public List<String> getColumns() {
            return columns;
        }

        public Selector id() {
            columns.add("shopcart.id");
            return this;
        }

        public Selector userid() {
            columns.add("shopcart.userid");
            return this;
        }

        public Selector goodsId() {
            columns.add("shopcart.goods_id");
            return this;
        }

        public Selector goodsNum() {
            columns.add("shopcart.goods_num");
            return this;
        }

        public Selector createdAt() {
            columns.add("shopcart.created_at");
            return this;
        }

        public Selector updatedAt() {
            columns.add("shopcart.updated_at");
            return this;
        }

        public Selector version() {
            columns.add("shopcart.version");
            return this;
        }

        public void clear() {
            columns.clear();
        }
    }

    public static class Order {
        private List<String> columns = new ArrayList<>();

        public int getSize() {
            return columns.size();
        }

        public List<String> getColumns() {
            return columns;
        }

        public Order add(String clause) {
            columns.add(clause);
            return this;
        }

        public Order ascId() {
            columns.add("shopcart.id ASC");
            return this;
        }

        public Order descId() {
            columns.add("shopcart.id DESC");
            return this;
        }

        public Order ascUserid() {
            columns.add("shopcart.userid ASC");
            return this;
        }

        public Order descUserid() {
            columns.add("shopcart.userid DESC");
            return this;
        }

        public Order ascGoodsId() {
            columns.add("shopcart.goods_id ASC");
            return this;
        }

        public Order descGoodsId() {
            columns.add("shopcart.goods_id DESC");
            return this;
        }

        public Order ascGoodsNum() {
            columns.add("shopcart.goods_num ASC");
            return this;
        }

        public Order descGoodsNum() {
            columns.add("shopcart.goods_num DESC");
            return this;
        }

        public Order ascCreatedAt() {
            columns.add("shopcart.created_at ASC");
            return this;
        }

        public Order descCreatedAt() {
            columns.add("shopcart.created_at DESC");
            return this;
        }

        public Order ascUpdatedAt() {
            columns.add("shopcart.updated_at ASC");
            return this;
        }

        public Order descUpdatedAt() {
            columns.add("shopcart.updated_at DESC");
            return this;
        }

        public Order ascVersion() {
            columns.add("shopcart.version ASC");
            return this;
        }

        public Order descVersion() {
            columns.add("shopcart.version DESC");
            return this;
        }

        public void clear() {
            columns.clear();
        }
    }

    public static class Limit {
        private int offset;

        private int rowCount;

        private boolean isLmtRow;

        public int getOffset() {
            return offset;
        }

        public int getRowCount() {
            return rowCount;
        }

        public boolean isIsLmtRow() {
            return isLmtRow;
        }

        public Limit(int rowCount) {
            this.rowCount = rowCount; 
            isLmtRow = false;
        }

        public Limit(int offset, int rowCount) {
            this.offset = offset; 
            this.rowCount = rowCount;
            isLmtRow = true;
        }
    }
}